﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Cofe.Core.Interfaces;

namespace Cofe.Core.Property
{
    public static class IPropertyCacheDictionaryExtension
    {
        public static IPropertyCacheDictionary Combine(params IPropertyCacheDictionary[] cacheDics)
        {
            IPropertyCacheDictionary retVal = new PropertyCacheDictionary();
            foreach (var d in cacheDics)
                foreach (var p in d.GetPropertiesInDic())
                {
                    if (!retVal.GetPropertiesInDic().Contains(p))
                        retVal.CacheProperty(d.GetProperty(p));
                }

            return retVal;
        }

    }
}
